<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<?php

$id = $_POST["hideId"];
if($id == "" || null == $id){
	$id = $_GET["postId"];
}
$codeValue = $_POST["code"];
$nameValue = $_POST["name"];
if($codeValue==""){
	//	echo ("<script>history.go(-1);</script>");
	echo ("<script>location.href('updateInfo.php?oldId=$id&msg=请输入编码!')</script>");
}
if($nameValue==""){
	//	exit('请输入姓名!');
	echo ("<script>location.href('updateInfo.php?oldId=$id&msg=请输入姓名!')</script>");
}else{
	$sql="update test set code='$codeValue',name='$nameValue' where id='$id'";
	$result=query($sql);
	if($result){
		echo ("<script>location.href('index.php')</script>");
	}else{
		echo "更新失败!";
	}
}
?>